<?php

namespace App\Controller\Web;

use App\Base\BaseConfig;
use App\Base\BaseController4Web;
use App\Entity\TimeLine;
use App\Model\ArtCategoryModel;
use App\Model\CityEntryModel;
use App\Model\TimeLineModel;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;

class ProvinceController extends BaseController4Web
{

    /**
     * @route("/province",name="WebProvinceIndex")
     */
    public function WebProvinceIndex(){
        $this->initData();
        $this->data["headTab"] = "";

        if (!$id = $this->getParamRequired("id")) {$id=0;}


        //时间节点
        $TimeLineModel = new TimeLineModel($this->getDoctrine());
        $timeLine = $TimeLineModel->getIndexData($id);
        if ($timeLine) {
            $this->data["timeLine"] = $timeLine;
        }else{
            $this->data["timeLine"] = new TimeLine();
        }

        //报名入口
        $CityEntryModel = new CityEntryModel($this->getDoctrine());
        $data = $CityEntryModel->getIndexData($id);
        $this->data["entry"] = $data;
        $this->data["entryCount"] = count($data);

        $this->data["provinceId"] = $id;
        $ArtCategoryModel = new ArtCategoryModel($this->getDoctrine());

        $data_list_zx = $ArtCategoryModel->getSons(BaseConfig::__CAT_KAOSHIZIXUN__);
        $this->data["list_zx"] = $data_list_zx;

        $data_list_gg = $ArtCategoryModel->getSons(BaseConfig::__CAT_KAOSHIGONGGAO__);
        $this->data["list_gg"] = $data_list_gg;





        //获取申论的子栏目
        $data_list_sl = $ArtCategoryModel->getSons(BaseConfig::__CAT_SHENLUN__);
        $this->data["list_sl"] = $data_list_sl;
        //获取行测的子栏目
        $data_list_xc = $ArtCategoryModel->getSons(BaseConfig::__CAT_XINGCE__);
        $this->data["list_xc"] = $data_list_xc;
        //获取公安的子栏目
        $data_list_ga = $ArtCategoryModel->getSons(BaseConfig::__CAT_GONGAN__);
        $this->data["list_ga"] = $data_list_ga;
        //获取时政的子栏目
        $data_list_sz = $ArtCategoryModel->getSons(BaseConfig::__CAT_SHIZHENG__);
        $this->data["list_sz"] = $data_list_sz;
        //获取面试的子栏目
        $data_list_ms = $ArtCategoryModel->getSons(BaseConfig::__CAT_MIANSHI__);
        $this->data["list_ms"] = $data_list_ms;

        //侧边栏
        //获取面试的子栏目
        $data_list_stxz = $ArtCategoryModel->getSons(BaseConfig::__CAT_SHITIXIAZAI__);
        $this->data["list_stxz"] = $data_list_stxz;


        return $this->render("Web/province.html.twig", $this->data);

    }
}
